import 'package:flutter/material.dart';
import 'package:kq_flutter_core_widget/utils/kq_screen_util.dart';
import 'package:kq_flutter_core_widget/utils/toast_util.dart';
import 'package:kq_flutter_core_widget/widgets/image/kq_image.dart';
import 'package:kq_flutter_tv_widgets/widgets/swiper/kq_swiper2.dart';

/// 轮播图Demo
class SwiperDemoPage extends StatefulWidget {
  const SwiperDemoPage({super.key});

  @override
  State<StatefulWidget> createState() => _SwiperDemoPageState();
}

class _SwiperDemoPageState extends State<SwiperDemoPage> {
  List<TestSwiperData> imgList = [
    TestSwiperData(
        "https://alifei05.cfp.cn/creative/vcg/800/version23/VCG41175510742.jpg",
        ImageType.http),
    TestSwiperData(
        "https://tenfei04.cfp.cn/creative/vcg/veer/1600water/veer-147317368.jpg",
        ImageType.http),
    TestSwiperData(
        "assets/images/remake/ic_delete_16_red.png", ImageType.assets),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: KqSwiper2<TestSwiperData>(
        width: 414.r,
        showData: imgList,
        indicator: DrawIndicator(),
        onTap: (index, data) {
          KqToast.showNormal("index=$index;image=${data.path}");
        },
      ),
    );
  }
}

class TestSwiperData extends IShowData {
  TestSwiperData(super.path, super.type);
}
